<!DOCTYPE html>
<!--[if IE 7 ]>   <html lang="en" class="ie7 lte8"> <![endif]--> 
<!--[if IE 8 ]>   <html lang="en" class="ie8 lte8"> <![endif]--> 
<!--[if IE 9 ]>   <html lang="en" class="ie9"> <![endif]--> 
<!--[if gt IE 9]> <html lang="en"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
<?php 
	session_start();
	if(isset($_SESSION['Quyen'])&& isset($_SESSION["IsAdmin"]))
	{
		if($_SESSION['Quyen'] == 1 && $_SESSION["IsAdmin"])
		{
			header('Location: QuanLySanPham.php');
		}
	}
?>
<meta charset="utf-8">
<!--[if lte IE 9 ]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
<!-- iPad Settings -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> 
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, width=device-width">
<!-- iPad End -->
<title>Login | Quang Du Co</title>
<link rel="shortcut icon" href="favicon.ico">
<!-- iOS ICONS -->
<link rel="apple-touch-icon" href="touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="touch-icon-iphone4.png" />
<link rel="apple-touch-startup-image" href="touch-startup-image.png">
<!-- iOS ICONS END -->
<!-- STYLESHEETS -->
<link rel="stylesheet" media="screen" href="css/reset.css" />
<link rel="stylesheet" media="screen" href="css/grids.css" />
<link rel="stylesheet" media="screen" href="css/style.css" />
<link rel="stylesheet" media="screen" href="css/jquery.uniform.css" />
<link rel="stylesheet" media="screen" href="css/forms.css" />
<link rel="stylesheet" media="screen" href="css/themes/lightblue/style.css" />
<style type = "text/css">
    #loading-container {position: absolute; top:50%; left:50%;}
    #loading-content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
    #loading-content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
    #loading-graphic {margin-right: 0.2em; margin-bottom:-2px;}
    #loading {background-color: #eeeeee; height:100%; width:100%; overflow:hidden; position: absolute; left: 0; top: 0; z-index: 99999;}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.js"></script> 
<script type="text/javascript">
$(function(){
	//alert($("input:[name='DiaChiHosting']").val());
	/* attach a submit handler to the form */
	  $("#form").submit(function(event) {
	
		/* stop form from submitting normally */
		event.preventDefault(); 
			
		/* get some values from elements on the page: */
		$.post("login.php", { 'username': $("input:[name='username']").val(),
								 'password':$("input:[name='password']").val()
								  },
								 function(data) {
									 	$( "#result" ).empty().append( data );
										//alert(data);
										if(data.search("Đăng nhập thành công") > 1)
											window.location.href = "QuanLySanPham.php";
									 });
	  });
});
</script>
<!-- STYLESHEETS END -->
<!--[if lt IE 9]>
<script src="js/html5.js"></script>
<script type="text/javascript" src="js/selectivizr.js"></script>
<![endif]-->
</head>
<body class="login" style="overflow: hidden;">
    <div id="loading"> 
        <script type = "text/javascript"> 
            document.write("<div id='loading-container'><p id='loading-content'>" +
                           "<img id='loading-graphic' width='16' height='16' src='images/ajax-loader-eeeeee.gif' /> " +
                           "Loading...</p></div>");
        </script> 
    </div> 
    <div class="login-box">
    	<section class="portlet login-box-top">
            <header>
                <h2 class="ac">Quản lý Quang Du Co</h2>
            </header>
            <section>
                <div class="message info">Điền mật khẩu và tài khoản quản lý</div>
                <form id="form" class="has-validation" action="/"  style="margin-top: 30px">
                    <p style="margin-bottom: 30px">
                        <input type="text" id="username" class="full" value="" name="username" required="required" placeholder="Username" />
                    </p>
                    <p style="margin-bottom: 30px">
                        <input type="password" id="password" class="full" value="" name="password" required="required" placeholder="Password" />
                    </p>
                    <p class="clearfix">
                        <!--<span class="fl" style="line-height: 23px;">
                            <label class="choice" for="remember">
                                <input type="checkbox" id="remember" class="" value="1" name="remember"/>
                                Remember me
                            </label>
                        </span>-->
                        <button class="fr" type="submit">Đăng nhập</button>
                    </p>
                </form>
                <div id="result">
                </div>
                <!--<footer class="ac">
                    <a href="#" class="button">Reset Password</a>
                    <a href="#" class="button">Register</a>
                </footer>-->
            </section>
    	</section>
	</div>
    
    <!-- MAIN JAVASCRIPTS -->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.js"></script>
    <script>window.jQuery || document.write("<script src='js/jquery.min.js'>\x3C/script>")</script>
    <script type="text/javascript" src="js/jquery.tools.min.js"></script>
    <script type="text/javascript" src="js/jquery.uniform.min.js"></script>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="js/PIE.js"></script>
    <script type="text/javascript" src="js/ie.js"></script>
    <![endif]-->
    <script type="text/javascript" src="js/global.js"></script>
    <!-- MAIN JAVASCRIPTS END -->
    <!-- LOADING SCRIPT -->
    <script>
    $(window).load(function(){
        $("#loading").fadeOut(function(){
            $(this).remove();
            $('body').removeAttr('style');
        });
    });
    $(document).ready(function(){
        $.tools.validator.fn("#username", function(input, value) {
            return value!='Username' ? true : {     
                en: "Please complete this mandatory field"
            };
        });
        
        $.tools.validator.fn("#password", function(input, value) {
            return value!='Password' ? true : {     
                en: "Please complete this mandatory field"
            };
        });
        $("#form").validator({ 
            position: 'bottom left', 
            messageClass:'form-error',
            message: '<div><em/></div>' // em element is the arrow
        });
    });
    </script>
    <!-- LOADING SCRIPT -->
</body>
</html>
